<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>登陆</title>
    <link rel="stylesheet" href="/css/reset.css">
    <link rel="stylesheet" href="/css/login.css">
</head>
<body>
<!-- 登陆 -->
<div class="login-container">
    <img class="login-head-img" src="/images/bg_login.png"/>
    <div class="user-login">
        <h1>登录</h1>
    </div>
    <form id="loginForm" onsubmit="return false;">
        <div><label><input name="phone" type="text" class="" placeholder="请输入您的手机号"/></label></div>
        <div><label><input name="validateCode" type="text" class="login-yanzm" placeholder="请输入您的验证码"/></label>
            <button class="login-post">发送验证码</button>
        </div>
        <div class="tishi fl">验证码错误</div>
        <div class="Noresgiter"><a href="/user/toSign">还未注册?</a></div>
        <button id="loginBtn" class="toLogin">登录</button>
    </form>
</div>
<jsp:include page="../common/jsResources.jsp"></jsp:include>
<script>
    $(document).ready(function () {
        $("#loginBtn").click(function() {
            var inputObject = getValuesByInputName([ "phone", "validateCode" ]);
            if(judgeInputValue(inputObject.phone, "phone")) return false;
            if(judgeInputValue(inputObject.validateCode, "notEmpty", "请输入验证码")) return false;
            var loginSucFunc = function(result) {
                location.href = "/index";
            }
            ajaxByMethod("/user/login", "post", inputObject, loginSucFunc);
        });
    })
</script>
</body>
</html>
